Repository navigation
fix(id-bench): recover stress_gen after interrupted generation - #13211
Merged
Merged
Conversation
stress_gen materialized directly into the output root and wrote manifest.json only at the end, so any failure mid-generation (the 100x tier is expected to hit resource walls) stranded the output path: a retry refused because the directory existed without a manifest, and the only recovery was manual deletion. The old code also removed an existing output root based only on the presence of a file named manifest.json, and wrote the manifest non-atomically. Generation now materializes into a staging sibling carrying an ownership marker, and publishes by rename: - prepare recovers a leftover staging directory only when its marker verifies it as this generator's, and refuses unverified content at either path with the cleanup action named; - a completed output root is replaced only after its manifest verifies (type "stress-manifest", schema_version 1), and only at publish time, so a failed regeneration keeps the last good fixture; - the manifest is written atomically (temp file, sync, rename) inside the staging directory before the publish rename, so the output root only ever holds a complete generation or nothing. The lifecycle lives in tests/common/stress_output.rs, included by the bench via #[path] (the loadgen pattern) and exercised by the new tests/stress_gen_recovery.rs integration suite: interrupted generation recovering on retry with a restorable published world, republish replacing a completed generation, and the three refusal shapes (foreign manifest, manifest-less partial, unmarked staging) each preserving the directory byte-for-byte.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 16 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #13181.
Problem
stress_genmaterialized directly into the output root and wrotemanifest.jsononly at the end. A failure mid-generation (the 100x tier is expected to hit resource walls, and the run protocol treats walls as results) stranded the output path: a retry refused because the directory existed without a manifest, with manual deletion as the only recovery. The old code also removed an existing output root based only on the presence of a file namedmanifest.json, and wrote the manifest non-atomically.Reproduced on pre-fix main:
ID_BENCH_STRESS_HOT_MEMBERS=0 --quick --only stress_genexits 1 after creating the output directory; the retry exits 1 withstress output root ... exists and holds no stress manifest; refusing to overwrite it.Change
Generation now materializes into a staging sibling of the output root and publishes by rename. The lifecycle lives in
pkgs/id/tests/common/stress_output.rs, included by the bench via#[path](the existingloadgenpattern) and exercised directly by the new integration suite:prepare_stress_outputdeletes a leftover staging directory only when its ownership marker (.stress-gen-staging.json, written before anything else) parses and names this generator. The completed output root is untouched until publish, so a failed regeneration keeps the last good fixture.type: "stress-manifest"andschema_version: 1. A foreign manifest, a manifest-less partial (the pre-fix stranded shape), or an unmarked staging directory is refused with the cleanup action named, and preserved byte-for-byte.bench_stress_genitself changes only in where it writes (staging instead of the root) and in delegating prepare/publish; the profile line, manifest contents, and generation determinism are unchanged.Verification
pkgs/id/tests/stress_gen_recovery.rs(5 tests, laptop,cargo test --test stress_gen_recovery): interrupted generation recovers on retry and the published world restores throughWorldCore::restorefrom its published location; republish replaces a completed generation (journal line count proves no merge); the three refusal shapes each preserve the directory byte-for-byte. All 5 pass (19/19 in the target including the sharedcommonmodule tests).commonunaffected:cargo test --test loadgen_determinism16/16.HOT_MEMBERS=0→ exit 1, no output root created, staging leftover carries the marker; retry with the same bad config → staging recovered, same real error (not the old refusal); retry fixed → success, profile line identical in shape with the same quick-tierhot_state_hash=8ef2ffc8a61f687brecorded when the profile landed in feat(id): seeded stress-world generator in world_bench (#13083) #13163 (determinism preserved); regeneration over the completed fixture → success; foreign-manifest directory → refusal with contents intact.--quick --only guest_replayunaffected.rustfmtapplied; clippy over the bench + new test target reports no warnings in the touched files.{ "direct_parent": null, "links": [], "lineage": { "design": null, "roadmap_item": null, "priority": null }, "pm_meta": 1, "provenance": { "queue_id": null, "scheduled_start": null, "picked_up_at": null, "work_started_at": null, "created_at": "2026-11-23T10:59:39Z", "session_id": null, "lane": null, "host": "amd", "worktree": "/home/user/wt-lane-qw-13181", "model": null, "lane_start_issues": [], "workspace_ref": { "kind": "worktree", "id": "/home/user/wt-lane-qw-13181", "repo": "developing-today/code", "branch": "lane-qw-13181", "sha": "cea664de6776bbba4794b9a64c066b3cf4efe7a4" }, "auth_subject": "oc-code-07", "stamped_by": "fleet 0.1.0 (native)" } }Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.